#输出矩阵A的范数计算结果

import numpy as np
p = int(input("请输入一个数："))
A = np.random.randn(4, 3)
S = 0
for i in range(A.shape[0]):
    for j in range(A.shape[1]):
        S += (A[i, j])**p
S = S**(1/p)
print("矩阵A的范数是{}".format(S))

'''
import numpy as np
p = int(input("请输入一个数："))
A = np.random.randn(4, 3)
norm = np.linalg.norm(A, ord=None)
print("矩阵 A 的范数是{}".format(norm))
'''